<!doctype html>



  


<html class="theme-next muse use-motion">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/vendors/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/vendors/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.0.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="java,spring boot," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.0.1" />






<meta name="description" content="1.外化配置Spring Boot允许配置文件位于jar外部，配合使用@Value()来完成外化注入PropertySource次序作为外化注入的参考次序：    1.命令行参数        //最高优先级 比如我们启动时指定的 –server.port=8800，这些属性将被添加到Environment中    2.来自于 java:/comp/env 的JNDI属性    3.系统属性 Sy">
<meta property="og:type" content="article">
<meta property="og:title" content="spring boot日常文档">
<meta property="og:url" content="http://yoursite.com/2016/08/30/spring-boot日常文档/index.html">
<meta property="og:site_name" content="个人博客">
<meta property="og:description" content="1.外化配置Spring Boot允许配置文件位于jar外部，配合使用@Value()来完成外化注入PropertySource次序作为外化注入的参考次序：    1.命令行参数        //最高优先级 比如我们启动时指定的 –server.port=8800，这些属性将被添加到Environment中    2.来自于 java:/comp/env 的JNDI属性    3.系统属性 Sy">
<meta property="og:updated_time" content="2017-01-19T07:14:13.732Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="spring boot日常文档">
<meta name="twitter:description" content="1.外化配置Spring Boot允许配置文件位于jar外部，配合使用@Value()来完成外化注入PropertySource次序作为外化注入的参考次序：    1.命令行参数        //最高优先级 比如我们启动时指定的 –server.port=8800，这些属性将被添加到Environment中    2.来自于 java:/comp/env 的JNDI属性    3.系统属性 Sy">



<script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Muse',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: 0,
      author: '博主'
    }
  };
</script>




  <link rel="canonical" href="http://yoursite.com/2016/08/30/spring-boot日常文档/"/>

  <title> spring boot日常文档 | 个人博客 </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">个人博客</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">随便写点什么</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  
  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                spring boot日常文档
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            <span class="post-meta-item-icon">
              <i class="fa fa-calendar-o"></i>
            </span>
            <span class="post-meta-item-text">发表于</span>
            <time itemprop="dateCreated" datetime="2016-08-30T15:25:33+08:00" content="2016-08-30">
              2016-08-30
            </time>
          </span>

          
            <span class="post-category" >
              &nbsp; | &nbsp;
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="https://schema.org/Thing">
                  <a href="/categories/spring-boot/" itemprop="url" rel="index">
                    <span itemprop="name">spring boot</span>
                  </a>
                </span>

                
                

              
            </span>
          

          
            
              <span class="post-comments-count">
                &nbsp; | &nbsp;
                <a href="/2016/08/30/spring-boot日常文档/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2016/08/30/spring-boot日常文档/" itemprop="commentsCount"></span>
                </a>
              </span>
            
          

          

          
          

          
        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="1-外化配置"><a href="#1-外化配置" class="headerlink" title="1.外化配置"></a>1.外化配置</h2><p>Spring Boot允许配置文件位于jar外部，配合使用@Value()来完成外化注入<br>PropertySource次序作为外化注入的参考次序：<br>    1.命令行参数        //最高优先级 比如我们启动时指定的 –server.port=8800，这些属性将被添加到Environment中<br>    2.来自于 java:/comp/env 的JNDI属性<br>    3.系统属性 System.getProperty()<br>    4.操作系统环境变量<br>    5.random.*产生的随机属性<br>    6.在打包的jar外的配置文件 （application.property）<br>    7.在打包的jar内的配置文件 （application.property）<br>    8.在@Configuration类上的 @PropertySource注解<br>    9.默认属性 SpringApplication.setDefaultProperty()<br><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="meta">@Compoment</span></div><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test</span></span>&#123;</div><div class="line">	<span class="meta">@Value</span>(<span class="string">"$&#123;name&#125;"</span>)</div><div class="line">	<span class="keyword">private</span> String name</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<a id="more"></a>
<p>我们可以在jar内的application.property文件中配置name属性<br>部署到生产环境时，使用jar外部提供的application.property提供的name属性来覆盖</p>
<p>这也是一般基层框架的主要实现</p>
<h2 id="2-application-property的加载"><a href="#2-application-property的加载" class="headerlink" title="2.application.property的加载"></a>2.application.property的加载</h2><p>SpringApplication将从以下几个位置加载配置文件：<br>    1.当前目录下的 /config 子目录<br>    2.当前目录<br>    3.classpath下的 /config 包<br>    4.classpath根路径 root<br>优先级从高到低<br>spring.config.name 可以使用其他文件来代替application.property   方式： –spring.config.name=myproperty<br>spring.config.location 可以用来声明一个完整的配资文件路径    方式：–spring.config.location=classpath:/default.property</p>
<p>可以用这种方式来部署生产环境的配置文件而不更改默认配置文件</p>
<h2 id="3-配置文件内属性的占位符"><a href="#3-配置文件内属性的占位符" class="headerlink" title="3.配置文件内属性的占位符"></a>3.配置文件内属性的占位符</h2><p>application.property内：<br><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">app.name=a</div><div class="line">app.desc=$&#123;app.name&#125; is a application</div></pre></td></tr></table></figure></p>
<p>可以直接在配置文件中使用占位符配置</p>
<h2 id="4-使用-ConfigurationProperties完成注入"><a href="#4-使用-ConfigurationProperties完成注入" class="headerlink" title="4.使用@ConfigurationProperties完成注入"></a>4.使用@ConfigurationProperties完成注入</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"><span class="meta">@Compoment</span></div><div class="line"><span class="meta">@ConfigurationProperties</span>(prefix=<span class="string">"user"</span>)</div><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">user</span></span>&#123;</div><div class="line">	<span class="keyword">private</span> String name;</div><div class="line">	<span class="keyword">private</span> String password;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>application.property<br>user.name=qianweifeng<br>user.password=qianweifeng</p>
<p>@ConfigurationProperties(prefix=”user”)该注解会把带user前缀的属性取出后，注入到bean中<br>且，该User类可以使用@Autowired直接置入到其他类中</p>
<h2 id="5-Profile-隔离应用程序的配置方式"><a href="#5-Profile-隔离应用程序的配置方式" class="headerlink" title="5.Profile 隔离应用程序的配置方式"></a>5.Profile 隔离应用程序的配置方式</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="meta">@Configuration</span></div><div class="line"><span class="meta">@Profile</span>(<span class="string">"dev"</span>)</div><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">dev</span></span>&#123;</div><div class="line">	...</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>在application.property中指定spring.profiles.avtive=dev<br>或者在启动命令中加 –spring.profiles.avtive=dev<br>该配置才会生效</p>
<h2 id="6-日志系统"><a href="#6-日志系统" class="headerlink" title="6.日志系统"></a>6.日志系统</h2><p>默认使用的是logback，且将日志打印到控制台<br>如果需要将日志打印到文件，可以在application.property中做如下配置<br>    1.logging.file=mylog.log        (可以是一个相对于当前目录或者是一个精确位置的文件)<br>    2.logging.path=/usr/log          (写到该目录下，可以是相对于当前目录也可以是一个精确位置的文件)<br>以上2选1即可，日志写到文件后会默认回显到控制台</p>
<p>或者可以通过配置一个logback.xml来配置日志（当然这是配置LogBack）<br>下面给出一个完成的logback.xml<br><figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div><div class="line">106</div><div class="line">107</div><div class="line">108</div><div class="line">109</div><div class="line">110</div><div class="line">111</div><div class="line">112</div><div class="line">113</div><div class="line">114</div><div class="line">115</div><div class="line">116</div><div class="line">117</div><div class="line">118</div><div class="line">119</div><div class="line">120</div><div class="line">121</div><div class="line">122</div><div class="line">123</div><div class="line">124</div><div class="line">125</div><div class="line">126</div><div class="line">127</div></pre></td><td class="code"><pre><div class="line">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</div><div class="line"><span class="tag">&lt;<span class="name">configuration</span>&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">springProfile</span> <span class="attr">name</span>=<span class="string">"test, staging, production"</span>&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">"LOG_HOME"</span> <span class="attr">value</span>=<span class="string">"/var/www/logs/usercenter"</span>/&gt;</span></div><div class="line"></div><div class="line">        <span class="tag">&lt;<span class="name">appender</span> <span class="attr">name</span>=<span class="string">"STDOUT"</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.ConsoleAppender"</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">layout</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.classic.PatternLayout"</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">Pattern</span>&gt;</span>%d&#123;HH:mm:ss.SSS&#125; [%t] %X&#123;tid&#125; %-5level %logger&#123;36&#125;:%msg%n<span class="tag">&lt;/<span class="name">Pattern</span>&gt;</span></div><div class="line">            <span class="tag">&lt;/<span class="name">layout</span>&gt;</span></div><div class="line">        <span class="tag">&lt;/<span class="name">appender</span>&gt;</span></div><div class="line"></div><div class="line">        <span class="tag">&lt;<span class="name">appender</span> <span class="attr">name</span>=<span class="string">"othersLog"</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.RollingFileAppender"</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">file</span>&gt;</span>$&#123;LOG_HOME&#125;/others/others.log<span class="tag">&lt;/<span class="name">file</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">rollingPolicy</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">FileNamePattern</span>&gt;</span>$&#123;LOG_HOME&#125;/others/others-%d&#123;yyyy-MM-dd&#125;-%i.log<span class="tag">&lt;/<span class="name">FileNamePattern</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">timeBasedFileNamingAndTriggeringPolicy</span></span></div><div class="line">                        <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"</span>&gt;</div><div class="line">                    <span class="tag">&lt;<span class="name">maxFileSize</span>&gt;</span>20MB<span class="tag">&lt;/<span class="name">maxFileSize</span>&gt;</span></div><div class="line">                <span class="tag">&lt;/<span class="name">timeBasedFileNamingAndTriggeringPolicy</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">MaxHistory</span>&gt;</span>10<span class="tag">&lt;/<span class="name">MaxHistory</span>&gt;</span></div><div class="line">            <span class="tag">&lt;/<span class="name">rollingPolicy</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">layout</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.classic.PatternLayout"</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">pattern</span>&gt;</span>%d&#123;HH:mm:ss.SSS&#125; [%t] [%X&#123;tid&#125;--&#123;userId&#125;] %-5level %logger&#123;36&#125;:%msg%n<span class="tag">&lt;/<span class="name">pattern</span>&gt;</span></div><div class="line">            <span class="tag">&lt;/<span class="name">layout</span>&gt;</span></div><div class="line">        <span class="tag">&lt;/<span class="name">appender</span>&gt;</span></div><div class="line"></div><div class="line">        <span class="tag">&lt;<span class="name">appender</span> <span class="attr">name</span>=<span class="string">"serviceLog"</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.RollingFileAppender"</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">File</span>&gt;</span>$&#123;LOG_HOME&#125;/service/service.log<span class="tag">&lt;/<span class="name">File</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">rollingPolicy</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">FileNamePattern</span>&gt;</span>$&#123;LOG_HOME&#125;/service/service.%d&#123;yyyy-MM-dd&#125;-%i.log</div><div class="line">                <span class="tag">&lt;/<span class="name">FileNamePattern</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">timeBasedFileNamingAndTriggeringPolicy</span></span></div><div class="line">                        <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"</span>&gt;</div><div class="line">                    <span class="tag">&lt;<span class="name">maxFileSize</span>&gt;</span>10MB<span class="tag">&lt;/<span class="name">maxFileSize</span>&gt;</span></div><div class="line">                <span class="tag">&lt;/<span class="name">timeBasedFileNamingAndTriggeringPolicy</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">maxHistory</span>&gt;</span>10<span class="tag">&lt;/<span class="name">maxHistory</span>&gt;</span></div><div class="line">            <span class="tag">&lt;/<span class="name">rollingPolicy</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">layout</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.classic.PatternLayout"</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">Pattern</span>&gt;</span>%d&#123;HH:mm:ss.SSS&#125; [%X&#123;tid&#125;--%X&#123;userId&#125;] %-5level</div><div class="line">                    %logger&#123;36&#125;.%M:%msg%n</div><div class="line">                <span class="tag">&lt;/<span class="name">Pattern</span>&gt;</span></div><div class="line">            <span class="tag">&lt;/<span class="name">layout</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">filter</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.classic.filter.LevelFilter"</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">level</span>&gt;</span>ERROR<span class="tag">&lt;/<span class="name">level</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">onMatch</span>&gt;</span>DENY<span class="tag">&lt;/<span class="name">onMatch</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">onMismatch</span>&gt;</span>ACCEPT<span class="tag">&lt;/<span class="name">onMismatch</span>&gt;</span></div><div class="line">            <span class="tag">&lt;/<span class="name">filter</span>&gt;</span></div><div class="line">        <span class="tag">&lt;/<span class="name">appender</span>&gt;</span></div><div class="line"></div><div class="line">        <span class="tag">&lt;<span class="name">appender</span> <span class="attr">name</span>=<span class="string">"errorLog"</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.RollingFileAppender"</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">file</span>&gt;</span>$&#123;LOG_HOME&#125;/error/error.log<span class="tag">&lt;/<span class="name">file</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">rollingPolicy</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">FileNamePattern</span>&gt;</span>$&#123;LOG_HOME&#125;/error/error.%d&#123;yyyy-MM-dd&#125;-%i.log</div><div class="line">                <span class="tag">&lt;/<span class="name">FileNamePattern</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">timeBasedFileNamingAndTriggeringPolicy</span></span></div><div class="line">                        <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"</span>&gt;</div><div class="line">                    <span class="tag">&lt;<span class="name">maxFileSize</span>&gt;</span>10MB<span class="tag">&lt;/<span class="name">maxFileSize</span>&gt;</span></div><div class="line">                <span class="tag">&lt;/<span class="name">timeBasedFileNamingAndTriggeringPolicy</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">MaxHistory</span>&gt;</span>10<span class="tag">&lt;/<span class="name">MaxHistory</span>&gt;</span></div><div class="line">            <span class="tag">&lt;/<span class="name">rollingPolicy</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">layout</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.classic.PatternLayout"</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">pattern</span>&gt;</span>%d&#123;HH:mm:ss.SSS&#125; [%X&#123;tid&#125;--%X&#123;userId&#125;] %-5level</div><div class="line">                    %logger&#123;36&#125;.%M:%msg%n</div><div class="line">                <span class="tag">&lt;/<span class="name">pattern</span>&gt;</span></div><div class="line">            <span class="tag">&lt;/<span class="name">layout</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">filter</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.classic.filter.LevelFilter"</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">level</span>&gt;</span>ERROR<span class="tag">&lt;/<span class="name">level</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">onMatch</span>&gt;</span>ACCEPT<span class="tag">&lt;/<span class="name">onMatch</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">onMismatch</span>&gt;</span>DENY<span class="tag">&lt;/<span class="name">onMismatch</span>&gt;</span></div><div class="line">            <span class="tag">&lt;/<span class="name">filter</span>&gt;</span></div><div class="line">        <span class="tag">&lt;/<span class="name">appender</span>&gt;</span></div><div class="line"></div><div class="line">        <span class="tag">&lt;<span class="name">appender</span> <span class="attr">name</span>=<span class="string">"usereventLog"</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.RollingFileAppender"</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">file</span>&gt;</span>$&#123;LOG_HOME&#125;/event/userevent.log<span class="tag">&lt;/<span class="name">file</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">append</span>&gt;</span>true<span class="tag">&lt;/<span class="name">append</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">rollingPolicy</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">FileNamePattern</span>&gt;</span>$&#123;LOG_HOME&#125;/event/userevent-%d&#123;yyyy-MM-dd&#125;-%i.log<span class="tag">&lt;/<span class="name">FileNamePattern</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">timeBasedFileNamingAndTriggeringPolicy</span></span></div><div class="line">                        <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"</span>&gt;</div><div class="line">                    <span class="tag">&lt;<span class="name">maxFileSize</span>&gt;</span>20MB<span class="tag">&lt;/<span class="name">maxFileSize</span>&gt;</span></div><div class="line">                <span class="tag">&lt;/<span class="name">timeBasedFileNamingAndTriggeringPolicy</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">MaxHistory</span>&gt;</span>30<span class="tag">&lt;/<span class="name">MaxHistory</span>&gt;</span></div><div class="line">            <span class="tag">&lt;/<span class="name">rollingPolicy</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">layout</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.classic.PatternLayout"</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">pattern</span>&gt;</span>%d&#123;HH:mm:ss.SSS&#125; %msg%n%n<span class="tag">&lt;/<span class="name">pattern</span>&gt;</span></div><div class="line">            <span class="tag">&lt;/<span class="name">layout</span>&gt;</span></div><div class="line">        <span class="tag">&lt;/<span class="name">appender</span>&gt;</span></div><div class="line"></div><div class="line">        <span class="tag">&lt;<span class="name">appender</span> <span class="attr">name</span>=<span class="string">"dataVerifyLog"</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.RollingFileAppender"</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">file</span>&gt;</span>$&#123;LOG_HOME&#125;/verify/dataVerify.log<span class="tag">&lt;/<span class="name">file</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">rollingPolicy</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">FileNamePattern</span>&gt;</span>$&#123;LOG_HOME&#125;/verify/dataVerify-%d&#123;yyyy-MM-dd&#125;-%i.log<span class="tag">&lt;/<span class="name">FileNamePattern</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">timeBasedFileNamingAndTriggeringPolicy</span></span></div><div class="line">                        <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"</span>&gt;</div><div class="line">                    <span class="tag">&lt;<span class="name">maxFileSize</span>&gt;</span>20MB<span class="tag">&lt;/<span class="name">maxFileSize</span>&gt;</span></div><div class="line">                <span class="tag">&lt;/<span class="name">timeBasedFileNamingAndTriggeringPolicy</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">MaxHistory</span>&gt;</span>10<span class="tag">&lt;/<span class="name">MaxHistory</span>&gt;</span></div><div class="line">            <span class="tag">&lt;/<span class="name">rollingPolicy</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">layout</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.classic.PatternLayout"</span>&gt;</span></div><div class="line">                <span class="tag">&lt;<span class="name">pattern</span>&gt;</span>%d&#123;HH:mm:ss.SSS&#125; [%t] [%X&#123;tid&#125;--&#123;userId&#125;] %-5level %logger&#123;36&#125;:%msg%n<span class="tag">&lt;/<span class="name">pattern</span>&gt;</span></div><div class="line">            <span class="tag">&lt;/<span class="name">layout</span>&gt;</span></div><div class="line">        <span class="tag">&lt;/<span class="name">appender</span>&gt;</span></div><div class="line"></div><div class="line">        <span class="tag">&lt;<span class="name">logger</span> <span class="attr">name</span>=<span class="string">"userEventLogger"</span> <span class="attr">level</span>=<span class="string">"info"</span> <span class="attr">additivity</span>=<span class="string">"false"</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"usereventLog"</span>/&gt;</span></div><div class="line">        <span class="tag">&lt;/<span class="name">logger</span>&gt;</span></div><div class="line"></div><div class="line">        <span class="tag">&lt;<span class="name">logger</span> <span class="attr">name</span>=<span class="string">"com.enniu.cloud.services.usercenter.dataverify"</span> <span class="attr">level</span>=<span class="string">"info"</span> <span class="attr">additivity</span>=<span class="string">"false"</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"dataVerifyLog"</span>/&gt;</span></div><div class="line">        <span class="tag">&lt;/<span class="name">logger</span>&gt;</span></div><div class="line"></div><div class="line">        <span class="tag">&lt;<span class="name">logger</span> <span class="attr">name</span>=<span class="string">"com.enniu.cloud.services.usercenter"</span> <span class="attr">level</span>=<span class="string">"info"</span> <span class="attr">additivity</span>=<span class="string">"false"</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"serviceLog"</span>/&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"errorLog"</span>/&gt;</span></div><div class="line">        <span class="tag">&lt;/<span class="name">logger</span>&gt;</span></div><div class="line"></div><div class="line">        <span class="tag">&lt;<span class="name">root</span> <span class="attr">level</span>=<span class="string">"info"</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"othersLog"</span>/&gt;</span></div><div class="line">        <span class="tag">&lt;/<span class="name">root</span>&gt;</span></div><div class="line"></div><div class="line">    <span class="tag">&lt;/<span class="name">springProfile</span>&gt;</span></div><div class="line"></div><div class="line"></div><div class="line">    <span class="tag">&lt;<span class="name">springProfile</span> <span class="attr">name</span>=<span class="string">"!production"</span>&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">include</span> <span class="attr">resource</span>=<span class="string">"org/springframework/boot/logging/logback/base.xml"</span>/&gt;</span></div><div class="line">    <span class="tag">&lt;/<span class="name">springProfile</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">configuration</span>&gt;</span></div></pre></td></tr></table></figure></p>
<h2 id="7-模板引擎"><a href="#7-模板引擎" class="headerlink" title="7.模板引擎"></a>7.模板引擎</h2><p>Spring boot中常用的模板引擎包括：Velocity，Freemarker等<br>且我们如果引入相应的模板引擎的依赖之后，Spring boot会对其自动配置<br>模板默认的存放位置: /src/main/resources/templates</p>
<h2 id="8-错误处理"><a href="#8-错误处理" class="headerlink" title="8.错误处理"></a>8.错误处理</h2><p>spring boot默认用一个/error来映射处理所有的错误，同时它在servlet容器中注册了一个错误页面<br>显示的内容大概如下：<br>Whitelabel Error Page</p>
<p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p>
<p>Tue Aug 30 11:58:25 CST 2016<br>There was an unexpected error (type=None, status=999).<br>No message available</p>
<p>为替换默认错误页面，我们可以定义一个ErrorController<br>覆写”/error”<br>然后自己用模板写一下这个error页面<br>不过如果我们需要多个错误页面以应对不同的比如40X，50X等错误<br><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line"><span class="meta">@Bean</span></div><div class="line">    <span class="function">EmbeddedServletContainerCustomizer <span class="title">containerCustomizer</span><span class="params">()</span></span>&#123;</div><div class="line">        <span class="keyword">return</span> <span class="keyword">new</span> MyCustomer();</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="class"><span class="keyword">class</span> <span class="title">MyCustomer</span> <span class="keyword">implements</span> <span class="title">EmbeddedServletContainerCustomizer</span></span>&#123;</div><div class="line"></div><div class="line">        <span class="meta">@Override</span></div><div class="line">        <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">customize</span><span class="params">(ConfigurableEmbeddedServletContainer configurableEmbeddedServletContainer)</span> </span>&#123;</div><div class="line">            configurableEmbeddedServletContainer.addErrorPages(<span class="keyword">new</span> ErrorPage(HttpStatus.BAD_REQUEST, <span class="string">"/400"</span>));  <span class="comment">// /400是路径</span></div><div class="line">        &#125;</div><div class="line">    &#125;</div></pre></td></tr></table></figure></p>
<p>这样的方式也是可以做到的，以此来完成的错误页面跳转，以及错误信息的展示是比较合理的（相比于在过滤器的跳转或者ajax请求在页面上的跳转）</p>
<h2 id="9-内嵌的servlet与filter"><a href="#9-内嵌的servlet与filter" class="headerlink" title="9.内嵌的servlet与filter"></a>9.内嵌的servlet与filter</h2><p>我们可以直接将servlet于filter注册为spring的bean</p>
<p>或者可以使用ServletRegistrationBean与FilterRegistrationBean完全进行控制</p>
<p>如果我们的类是实现ServletContextInitializer的，也可以直接注册他们</p>
<h2 id="10-自定义内嵌servlet容器"><a href="#10-自定义内嵌servlet容器" class="headerlink" title="10.自定义内嵌servlet容器"></a>10.自定义内嵌servlet容器</h2><pre><code>方式1：application.property中进行属性配置
       比如 server.port   //端口
               server.address // 地址
               server.sessionTimeout //session超时
方式2：编程方式定义
<figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line"><span class="meta">@Compoment</span></div><div class="line"> <span class="class"><span class="keyword">class</span> <span class="title">MyCustomer</span> <span class="keyword">implements</span> <span class="title">EmbeddedServletContainerCustomizer</span></span>&#123;</div><div class="line"></div><div class="line">      <span class="meta">@Override</span></div><div class="line">      <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">customize</span><span class="params">(ConfigurableEmbeddedServletContainer configurableEmbeddedServletContainer)</span> </span>&#123;</div><div class="line">      	configurableEmbeddedServletContainer.setPort(<span class="number">8800</span>);</div><div class="line">      	<span class="comment">//这里提供了大量的set方法来设置一些属性</span></div><div class="line">          configurableEmbeddedServletContainer.addErrorPages(<span class="keyword">new</span> ErrorPage(HttpStatus.BAD_REQUEST, <span class="string">"/400"</span>));  <span class="comment">// /400是路径</span></div><div class="line">      	&#125;</div><div class="line">  	&#125;</div></pre></td></tr></table></figure>

方式3：直接自定义ConfigurableEmbeddedServletContainer
<figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">	<span class="meta">@Bean</span></div><div class="line">	<span class="class"><span class="keyword">class</span> <span class="title">MyCustomer</span> </span>&#123;</div><div class="line">TomcatEmbeddedServletContainerFactory	factory = <span class="keyword">new</span> TomcatEmbeddedServletContainerFactory();</div><div class="line">factory.setPort(<span class="number">8800</span>);</div><div class="line">factory.setSessionTimeout(<span class="number">10</span>);</div><div class="line">factory.addErrorPages(<span class="keyword">new</span> ErrorPage(HttpStatus.BAD_REQUEST, <span class="string">"/400"</span>));</div><div class="line"><span class="comment">//也提供了大量的set方法</span></div><div class="line">	&#125;</div></pre></td></tr></table></figure>
</code></pre><p>也就是说我们有多重方法来设置比如tomcat的一些属性，可以通过配置文件，可以通过启动命令，也可以通过编程注册bean的方式</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/java/" rel="tag">#java</a>
          
            <a href="/tags/spring-boot/" rel="tag">#spring boot</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2016/08/29/java编程建议-1/" rel="next" title="java编程建议">
                <i class="fa fa-chevron-left"></i> java编程建议
              </a>
            
          </div>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2016/09/19/redis-confguration/" rel="prev" title="redis3.x配置文件详解">
                redis3.x配置文件详解 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div class="ds-thread" data-thread-key="2016/08/30/spring-boot日常文档/"
           data-title="spring boot日常文档" data-url="http://yoursite.com/2016/08/30/spring-boot日常文档/">
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel ">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/uploads/touxiang.jpg"
               alt="钱伟峰" />
          <p class="site-author-name" itemprop="name">钱伟峰</p>
          <p class="site-description motion-element" itemprop="description">每天进步一点点</p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">21</span>
              <span class="site-state-item-name">日志</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">7</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">11</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

      </section>

      
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">
            
              
            
            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-外化配置"><span class="nav-number">1.</span> <span class="nav-text">1.外化配置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-application-property的加载"><span class="nav-number">2.</span> <span class="nav-text">2.application.property的加载</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-配置文件内属性的占位符"><span class="nav-number">3.</span> <span class="nav-text">3.配置文件内属性的占位符</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-使用-ConfigurationProperties完成注入"><span class="nav-number">4.</span> <span class="nav-text">4.使用@ConfigurationProperties完成注入</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-Profile-隔离应用程序的配置方式"><span class="nav-number">5.</span> <span class="nav-text">5.Profile 隔离应用程序的配置方式</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-日志系统"><span class="nav-number">6.</span> <span class="nav-text">6.日志系统</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#7-模板引擎"><span class="nav-number">7.</span> <span class="nav-text">7.模板引擎</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#8-错误处理"><span class="nav-number">8.</span> <span class="nav-text">8.错误处理</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#9-内嵌的servlet与filter"><span class="nav-number">9.</span> <span class="nav-text">9.内嵌的servlet与filter</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#10-自定义内嵌servlet容器"><span class="nav-number">10.</span> <span class="nav-text">10.自定义内嵌servlet容器</span></a></li></ol></div>
            
          </div>
        </section>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">钱伟峰</span>
</div>

<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Muse
  </a>
</div>

        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/vendors/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/vendors/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/vendors/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.0.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.0.1"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.0.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.0.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.0.1"></script>



  

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"qianweifeng"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>

  
    
    <script src="/vendors/ua-parser-js/dist/ua-parser.min.js?v=0.7.9"></script>
    <script src="/js/src/hook-duoshuo.js"></script>
  






  
  

  

  

  

</body>
</html>
